package com.example.studentstatusmanagement.mapper;

import com.example.studentstatusmanagement.pojo.Dorm;
import com.example.studentstatusmanagement.pojo.DormExample;
import java.util.List;

import com.example.studentstatusmanagement.pojo.doo.ReqRoom;
import com.example.studentstatusmanagement.pojo.dto.DormInfo;
import com.example.studentstatusmanagement.pojo.dto.SRoom;
import com.example.studentstatusmanagement.pojo.dto.StudentInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface DormMapper {
    int countByExample(DormExample example);

    int deleteByExample(DormExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Dorm record);

    int insertSelective(Dorm record);

    List<Dorm> selectByExample(DormExample example);

    Dorm selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Dorm record, @Param("example") DormExample example);

    int updateByExample(@Param("record") Dorm record, @Param("example") DormExample example);

    int updateByPrimaryKeySelective(Dorm record);

    int updateByPrimaryKey(Dorm record);


    @Select("select d.id,d.dorm_number as name from dorm d where d.isdel = 0 and plot_id = #{id}")
    List<DormInfo> selectDormsByPlotId(Integer id);


    @Select("SELECT p.id as fid ,p.plotname as name FROM plot p where p.isdel = 0 GROUP BY name")
    List<ReqRoom> selectPlotsForDrom();

    List<SRoom> selectDorms(ReqRoom reqRoom);


}